// pages/login/index.js
const app = getApp();
const $api = require("../../api/login").API

Page({

  /**
   * 页面的初始数据
   */
  data: {
    show:true,
    account:"15843178264",
    password:"123456",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  onChangezh(e){
    var t =this
    t.setData({
      account:e.detail
    })
  },
  onChangemm(e){
    var t =this
    t.setData({
      password:e.detail
    })
  },
  // 登录
  login(e){
    console.log(e.currentTarget.dataset.id)
    var t = this
    var data={
      app_type:"android",
      member_mobile:t.data.account,
      member_pass:t.data.password,
      member_type:1,
      os_type:"android"
    }
    $api.login(data).then(res=>{
      console.log(res)
      wx.setStorageSync('memberinfo', res.data)
      t.getTeacherClassList(res.data.member_id)
    })
    
  },
  getTeacherClassList(e){
    var t = this
    var data= {
      member_id:e,
    }
    $api.getTeacherClassList(data).then(res=>{
      console.log(res)
      wx.setStorageSync('TeacherClassinfo', res.data[0])
      wx.switchTab({
        url: '/pages/index/index',
      })
    })
  }
})